<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>量化表填写</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
    <script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script src="../js/jquery-3.1.1.min.js"></script>
    <style>
        #form {
            width: 80%;
            margin: 2.5% auto;
        }

        #table {
            width: 100%;
        }

        #table tr {
            width: 100%;
        }

        #table td {
            width: 200px;
            height: 30px;
            text-align: center;
        }

        .type:hover {
            color: #4D67F8;
            text-decoration: underline;
            cursor: pointer;
        }

        .material:hover {
            color: #4D67F8;
            text-decoration: underline;
            cursor: pointer;
        }

        .layui-input {
            width: 300px;
        }

        .layui-form-radio:hover *,
        .layui-form-radioed,
        .layui-form-radioed>i {
            color: #FCBF5B
        }
    </style>
</head>

<body>
    <div>
        <div id="bar" style="margin: 30px;margin-left: 73%;">
            <button id="news" class="layui-btn  layui-btn-primary">审核动态<span class="layui-badge-dot layui-bg-orange"
                    id="badge"></span></button>
            <button id="refill" class="layui-btn  layui-btn-primary">重新填写</button>
        </div>
        <div id="form">
            <div>
                <h2 style="text-align: center;margin:20px;font-weight:bold;">
                    <span id="college">信息学院</span>
                    <span id="year">2020-2021学年</span>
                    综合评分统计表(Q2)
                </h2>
                <div>
                    <span style="font-size:16px;font-weight:bold;margin-right: 150px;">班级：<span
                            id="class">信息19-2</span></span>
                    <span style="font-size:16px;font-weight:bold;margin-right: 150px;">姓名：<span
                            id="name">张雯瑷</span></span>
                    <span style="font-size:16px;font-weight:bold;margin-right: 150px;">学号：<span
                            id="sno">191001229</span></span>
                    <span style="font-size:16px;font-weight:bold;">量化总得分(Q2)：<span id="total">94</span></span>
                </div>
                <div style="line-height: 22px;margin: 10px 0;">
                    <p>1.此表必须如实填写，如有虚假，后果自负，直至取消评优资格。</p>
                    <p>2.所有加分项目必须附有效证明材料，没有证明材料分数不统计。</p>
                    <p>3.所有加分项写准确名称、分数、证明材料编号，不写分数不予统计；每一类加分项可自加行或减行，不可改变表格结构。</p>
                    <p>注：量化考核分的计算方法为：Q2=T1+T2+T3+T4+T5+T6-T7。</p>
                    <p style="margin-left:30px;">
                        其中，Q2为量化累加总分，T1为社会职务加分，上限为25分；T2为德育加分，上限为30分；T3为智育(创新)加分，无上限；T4为体育加分，T5为美育加分，T4
                        与T5总和的上限为50分；T6为劳育加分，该项为附加分，上限为5分；T7为扣分内容。
                        Q2最高分值为100分，超出最高分值的按100分记。</p>
                </div>
            </div>
            <table cellspacing="0" border="2px" id="table">
                <tr>
                    <td rowspan="2">加分项</td>
                    <td colspan="3">第一学期</td>
                    <td colspan="3">第二学期</td>
                </tr>
                <tr>
                    <td>名称</td>
                    <td>分数</td>
                    <td>证明材料编号</td>
                    <td>名称</td>
                    <td>分数</td>
                    <td>证明材料编号</td>
                </tr>
                <tr class="SHZW_tr">
                    <td rowspan="4" class="type" id="SHZW">社会职务</td>
                    <td class="SHZW_name1"></td>
                    <td class="SHZW_score1"></td>
                    <td class="SHZW_material1"></td>
                    <td class="SHZW_name2"></td>
                    <td class="SHZW_score2"></td>
                    <td class="SHZW_material2"></td>
                </tr>
                <tr class="SHZW_tr">
                    <td class="SHZW_name1"></td>
                    <td class="SHZW_score1"></td>
                    <td class="SHZW_material1"></td>
                    <td class="SHZW_name2"></td>
                    <td class="SHZW_score2"></td>
                    <td class="SHZW_material2"></td>
                </tr>
                <tr class="SHZW_tr">
                    <td class="SHZW_name1"></td>
                    <td class="SHZW_score1"></td>
                    <td class="SHZW_material1"></td>
                    <td class="SHZW_name2"></td>
                    <td class="SHZW_score2"></td>
                    <td class="SHZW_material2"></td>
                <tr>
                    <td>分数小计：</td>
                    <td id="SHZW_total1"></td>
                    <td></td>
                    <td>分数小计：</td>
                    <td id="SHZW_total2"></td>
                    <td></td>
                </tr>
                <tr class="DY_tr">
                    <td rowspan="4" class="type" id="DY">德育</td>
                    <td class="DY_name1"></td>
                    <td class="DY_score1"></td>
                    <td class="DY_material1"></td>
                    <td class="DY_name2"></td>
                    <td class="DY_score2"></td>
                    <td class="DY_material2"></td>
                </tr>
                <tr class="DY_tr">
                    <td class="DY_name1"></td>
                    <td class="DY_score1"></td>
                    <td class="DY_material1"></td>
                    <td class="DY_name2"></td>
                    <td class="DY_score2"></td>
                    <td class="DY_material2"></td>
                </tr>
                <tr class="DY_tr">
                    <td class="DY_name1"></td>
                    <td class="DY_score1"></td>
                    <td class="DY_material1"></td>
                    <td class="DY_name2"></td>
                    <td class="DY_score2"></td>
                    <td class="DY_material2"></td>
                </tr>
                <tr>
                    <td>分数小计：</td>
                    <td id="DY_total1"></td>
                    <td></td>
                    <td>分数小计：</td>
                    <td id="DY_total2"></td>
                    <td></td>
                </tr>
                <tr class="MY_tr">
                    <td rowspan="4" class="type" id="ZY">智育</td>
                    <td class="ZY_name1"></td>
                    <td class="ZY_score1"></td>
                    <td class="ZY_material1"></td>
                    <td class="ZY_name2"></td>
                    <td class="ZY_score2"></td>
                    <td class="ZY_material2"></td>
                </tr>
                <tr class="MY_tr">
                    <td class="ZY_name1"></td>
                    <td class="ZY_score1"></td>
                    <td class="ZY_material1"></td>
                    <td class="ZY_name2"></td>
                    <td class="ZY_score2"></td>
                    <td class="ZY_material2"></td>
                </tr>
                <tr class="MY_tr">
                    <td class="ZY_name1"></td>
                    <td class="ZY_score1"></td>
                    <td class="ZY_material1"></td>
                    <td class="ZY_name2"></td>
                    <td class="ZY_score2"></td>
                    <td class="ZY_material2"></td>
                </tr>
                <tr>
                    <td>分数小计：</td>
                    <td id="ZY_total1"></td>
                    <td></td>
                    <td>分数小计：</td>
                    <td id="ZY_total2"></td>
                    <td></td>
                </tr>
                <tr class="TY_tr">
                    <td rowspan="4" class="type" id="TY">体育</td>
                    <td class="TY_name1"></td>
                    <td class="TY_score1"></td>
                    <td class="TY_material1"></td>
                    <td class="TY_name2"></td>
                    <td class="TY_score2"></td>
                    <td class="TY_material2"></td>
                </tr>
                <tr class="TY_tr">
                    <td class="TY_name1"></td>
                    <td class="TY_score1"></td>
                    <td class="TY_material1"></td>
                    <td class="TY_name2"></td>
                    <td class="TY_score2"></td>
                    <td class="TY_material2"></td>
                </tr>
                <tr class="TY_tr">
                    <td class="TY_name1"></td>
                    <td class="TY_score1"></td>
                    <td class="TY_material1"></td>
                    <td class="TY_name2"></td>
                    <td class="TY_score2"></td>
                    <td class="TY_material2"></td>
                </tr>
                <tr>
                    <td>分数小计：</td>
                    <td id="TY_total1"></td>
                    <td></td>
                    <td>分数小计：</td>
                    <td id="TY_total2"></td>
                    <td></td>
                </tr>
                <tr class="MY_tr">
                    <td rowspan="4" class="type" id="MY">美育</td>
                    <td class="MY_name1"></td>
                    <td class="MY_score1"></td>
                    <td class="MY_material1"></td>
                    <td class="MY_name2"></td>
                    <td class="MY_score2"></td>
                    <td class="MY_material2"></td>
                </tr>
                <tr class="MY_tr">
                    <td class="MY_name1"></td>
                    <td class="MY_score1"></td>
                    <td class="MY_material1"></td>
                    <td class="MY_name2"></td>
                    <td class="MY_score2"></td>
                    <td class="MY_material2"></td>
                </tr>
                <tr class="MY_tr">
                    <td class="MY_name1"></td>
                    <td class="MY_score1"></td>
                    <td class="MY_material1"></td>
                    <td class="MY_name2"></td>
                    <td class="MY_score2"></td>
                    <td class="MY_material2"></td>
                </tr>
                <tr>
                    <td>分数小计：</td>
                    <td id="MY_total1"></td>
                    <td></td>
                    <td>分数小计：</td>
                    <td id="MY_total2"></td>
                    <td></td>
                </tr>
                <tr class="LY_tr">
                    <td rowspan="4" class="type" id="LY">劳育</td>
                    <td class="LY_name1"></td>
                    <td class="LY_score1"></td>
                    <td class="LY_material1"></td>
                    <td class="LY_name2"></td>
                    <td class="LY_score2"></td>
                    <td class="LY_material2"></td>
                </tr>
                <tr class="LY_tr">
                    <td class="LY_name1"></td>
                    <td class="LY_score1"></td>
                    <td class="LY_material1"></td>
                    <td class="LY_name2"></td>
                    <td class="LY_score2"></td>
                    <td class="LY_material2"></td>
                </tr>
                <tr class="LY_tr">
                    <td class="LY_name1"></td>
                    <td class="LY_score1"></td>
                    <td class="LY_material1"></td>
                    <td class="LY_name2"></td>
                    <td class="LY_score2"></td>
                    <td class="LY_material2"></td>
                </tr>
                <tr>
                    <td>分数小计：</td>
                    <td id="LY_total1"></td>
                    <td></td>
                    <td>分数小计：</td>
                    <td id="LY_total2"></td>
                    <td></td>
                </tr>
                <tr class="KF_tr">
                    <td rowspan="4" class="type" id="KF">扣分项目</td>
                    <td class="KF_name1"></td>
                    <td class="KF_score1"></td>
                    <td class="KF_material1"></td>
                    <td class="KF_name2"></td>
                    <td class="KF_score2"></td>
                    <td class="KF_material2"></td>
                </tr>
                <tr class="KF_tr">
                    <td class="KF_name1"></td>
                    <td class="KF_score1"></td>
                    <td class="KF_material1"></td>
                    <td class="KF_name2"></td>
                    <td class="KF_score2"></td>
                    <td class="KF_material2"></td>
                </tr>
                <tr class="KF_tr">
                    <td class="KF_name1"></td>
                    <td class="KF_score1"></td>
                    <td class="KF_material1"></td>
                    <td class="KF_name2"></td>
                    <td class="KF_score2"></td>
                    <td class="KF_material2"></td>
                </tr>
                <tr>
                    <td>分数小计：</td>
                    <td id="KF_total1"></td>
                    <td></td>
                    <td>分数小计：</td>
                    <td id="KF_total2"></td>
                    <td></td>
                </tr>
                <tr style="height: 80px;">
                    <td>本人签字：</td>
                    <td colspan="3" id="self_writing"></td>
                    <td>班主任签字：</td>
                    <td colspan="3" id="teacher_writing"></td>
                </tr>
            </table>
        </div>
        <div id="fun" style="width:480px;margin: 50px auto;">
            <button type="button" class="layui-btn" style="margin: 20px;background-color: #FB9101;"
                id="print">打印量化表</button>
            <button type="button" class="layui-btn" style="margin: 20px;background-color: #FB9101;"
                id="writingBtn">本人签字</button>
            <button type="button" class="layui-btn" style="margin: 20px;background-color: #FB9101;"
                id="submitBtn">提交给班主任</button>
        </div>
    </div>
    <script src="../js/lay-config.js?v=2.0.0" charset="utf-8"></script>
    <script src="../js/test_login.js"></script>
    <script>
        window.onresize = function () {
            if (window.outerWidth == 836)
                document.getElementById("bar").style.margin = "30px 30px 30px 63%";
            else {
                document.getElementById("bar").style.margin = "30px 30px 30px 73%";
            }
        }
        layui.use(['jquery', 'layer', 'form', 'upload'], function () {
            var $ = layui.jquery,
                layer = layui.layer,
                form = layui.form,
                upload = layui.upload;
            var username = localStorage.getItem("name");
            var url = '';
            var SHZW_Data1 = [],
                SHZW_Data2 = [];
            var DY_Data1 = [],
                DY_Data2 = [];
            var MY_Data1 = [],
                MY_Data2 = [];
            var ZY_Data1 = [],
                ZY_Data2 = [];
            var TY_Data1 = [],
                TY_Data2 = [];
            var LY_Data1 = [],
                LY_Data2 = [];
            var KF_Data1 = [],
                KF_Data2 = [];
            var SHZW_num1 = 0,
                SHZW_num2 = 0;
            var DY_num1 = 0,
                DY_num2 = 0;
            var MY_num1 = 0,
                MY_num2 = 0;
            var ZY_num1 = 0,
                ZY_num2 = 0;
            var TY_num1 = 0,
                TY_num2 = 0;
            var LY_num1 = 0,
                LY_num2 = 0;
            var KF_num1 = 0,
                KF_num2 = 0;
            var SHZW_total1 = 0,
                SHZW_total2 = 0;
            var DY_total1 = 0,
                DY_total2 = 0;
            var ZY_total1 = 0,
                ZY_total2 = 0;
            var TY_total1 = 0,
                TY_total2 = 0;
            var MY_total1 = 0,
                MY_total2 = 0;
            var LY_total1 = 0,
                LY_total2 = 0;
            var KF_total1 = 0,
                KF_total2 = 0;
            var SHZW_more_num1 = 0,
                SHZW_more_num2 = 0;
            var DY_more_num1 = 0,
                DY_more_num2 = 0;
            var ZY_more_num1 = 0,
                ZY_more_num2 = 0;
            var TY_more_num1 = 0,
                TY_more_num2 = 0;
            var MY_more_num1 = 0,
                MY_more_num2 = 0;
            var LY_more_num1 = 0,
                LY_more_num2 = 0;
            var KF_more_num1 = 0,
                KF_more_num2 = 0;
            var addnum = 0;
            var index = "";
            var item_type = "";
            var item_num1 = 0;
            var item_num2 = 0;
            var item_total1 = 0;
            var item_total2 = 0;
            var status = 0; //标记量化表状态
            var refill = 0; //标记是否重新填写
            localStorage.setItem("status", status);
            $('#news').on('click', function () {
                var item = "";
                $.get('/form', {
                    status: 11
                }, function (re) {
                    if (re == '0') {
                        layer.msg("暂无动态！");
                    } else {
                        for (var i = 0; i < re.data.length; i++) {
                            item +=
                                '<li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis">&#xe63f;</i><div class="layui-timeline-content layui-text"><h4 class="layui-timeline-title">' +
                                re.data[i].time + '</h4><p style="font-size:14px">' + re.data[i]
                                .content + '</p><br></li>';
                        }
                        layer.open({
                            title: "查看审核动态",
                            area: ['400px', '300px'],
                            type: 1,
                            content: '<div style="padding:15px"><ul id="time_line" class="layui-timeline">' +
                                item + '</ul><div>',
                        })
                    }
                });

            })
            //重新填写
            $('#refill').on('click', function () {
                var index = layer.alert("您是否要重新填写", function () {
                    var html = localStorage.getItem("html");
                    $("#table").html(html);
                    $.get('/form', {
                        status: 2
                    }, function (re) {
                        addnum = 0;
                        SHZW_Data1 = [];
                        SHZW_Data2 = [];
                        DY_Data1 = [];
                        DY_Data2 = [];
                        MY_Data1 = [];
                        MY_Data2 = [];
                        ZY_Data1 = [];
                        ZY_Data2 = [];
                        TY_Data1 = [];
                        TY_Data2 = [];
                        LY_Data1 = [];
                        LY_Data2 = [];
                        KF_Data1 = [];
                        KF_Data2 = [];
                        SHZW_num1 = 0;
                        SHZW_num2 = 0;
                        DY_num1 = 0;
                        DY_num2 = 0;
                        MY_num1 = 0;
                        MY_num2 = 0;
                        ZY_num1 = 0;
                        ZY_num2 = 0;
                        TY_num1 = 0;
                        TY_num2 = 0;
                        LY_num1 = 0;
                        LY_num2 = 0;
                        KF_num1 = 0;
                        KF_num2 = 0;
                        SHZW_total1 = 0;
                        SHZW_total2 = 0;
                        DY_total1 = 0;
                        DY_total2 = 0;
                        ZY_total1 = 0;
                        ZY_total2 = 0;
                        TY_total1 = 0;
                        TY_total2 = 0;
                        MY_total1 = 0;
                        MY_total2 = 0;
                        LY_total1 = 0;
                        LY_total2 = 0;
                        KF_total1 = 0;
                        KF_total2 = 0;
                        SHZW_more_num1 = 0;
                        SHZW_more_num2 = 0;
                        DY_more_num1 = 0;
                        DY_more_num2 = 0;
                        ZY_more_num1 = 0;
                        ZY_more_num2 = 0;
                        TY_more_num1 = 0;
                        TY_more_num2 = 0;
                        MY_more_num1 = 0;
                        MY_more_num2 = 0;
                        LY_more_num1 = 0;
                        LY_more_num2 = 0;
                        KF_more_num1 = 0;
                        KF_more_num2 = 0;
                        var addnum = 0;
                        var index = "";
                        var item_type = "";
                        var item_num1 = 0;
                        var item_num2 = 0;
                        var item_total1 = 0;
                        var item_total2 = 0;
                        refill = 1;
                        $('#SHZW_total1').html(SHZW_total1);
                        $('#SHZW_total2').html(SHZW_total2);
                        $('#KF_total1').html(KF_total1);
                        $('#KF_total2').html(KF_total2);
                        $('#LY_total1').html(MY_total1);
                        $('#LY_total2').html(MY_total2);
                        for (var i = 0; i < re.data.length; i++) {
                            if (re.data[i].type == '德育') {
                                var dataItem = {
                                    a_name: '',
                                    score: '',
                                    proof: ''
                                };
                                dataItem.a_name = re.data[i].a_name;
                                dataItem.score = re.data[i].score;
                                if (re.data[i].term == '1') {
                                    DY_Data1[DY_num1] = dataItem;
                                    DY_num1++;
                                } else if (re.data[i].term == '2') {
                                    DY_Data2[DY_num2] = dataItem;
                                    DY_num2++;
                                }
                            } else if (re.data[i].type == '美育') {
                                var dataItem = {
                                    a_name: '',
                                    score: '',
                                    proof: ''
                                };
                                dataItem.a_name = re.data[i].a_name;
                                dataItem.score = re.data[i].score;
                                if (re.data[i].term == '1') {
                                    MY_Data1[MY_num1] = dataItem;
                                    MY_num1++;
                                } else if (re.data[i].term == '2') {
                                    MY_Data2[MY_num2] = dataItem;
                                    MY_num2++;
                                }
                            } else if (re.data[i].type == '智育') {
                                var dataItem = {
                                    a_name: '',
                                    score: '',
                                    proof: ''
                                };
                                dataItem.a_name = re.data[i].a_name;
                                dataItem.score = re.data[i].score;
                                if (re.data[i].term == '1') {
                                    ZY_Data1[ZY_num1] = dataItem;
                                    ZY_num1++;
                                } else if (re.data[i].term == '2') {
                                    ZY_Data2[ZY_num2] = dataItem;
                                    ZY_num2++;
                                }
                            } else if (re.data[i].type == '体育') {
                                var dataItem = {
                                    a_name: '',
                                    score: '',
                                    proof: ''
                                };
                                dataItem.a_name = re.data[i].a_name;
                                dataItem.score = re.data[i].score;
                                if (re.data[i].term == '1') {
                                    TY_Data1[TY_num1] = dataItem;
                                    TY_num1++;
                                } else if (re.data[i].term == '2') {
                                    TY_Data2[TY_num2] = dataItem;
                                    TY_num2++;
                                }
                            }
                        }
                        //加载德育活动
                        DY_html = '';
                        for (var i = 0; i < DY_num1; i++) {
                            if (i < 3) {
                                $('.DY_name1').eq(i).html(
                                    DY_Data1[i].a_name);
                                $('.DY_score1').eq(i).html(
                                    DY_Data1[i].score);
                            } else {
                                DY_more_num1++;
                                DY_html += '<tr><td class = "DY_name1" >' +
                                    DY_Data1[
                                        i]
                                    .a_name +
                                    ' </td> <td class = "DY_score1" > ' +
                                    DY_Data1[
                                        i].score +
                                    '</td> <td class = "DY_material1" > </td><td class = "DY_name2" > </td> <td class = "DY_score2" > </td> <td class = "DY_material2" > </td> </tr>';
                            }
                            DY_total1 += DY_Data1[i].score;
                        }
                        for (var i = 0; i < DY_num2; i++) {
                            if (i < 3) {
                                $('.DY_name2').eq(i).html(
                                    DY_Data2[i].a_name);
                                $('.DY_score2').eq(i).html(
                                    DY_Data2[i].score);
                            } else {
                                DY_more_num2++;
                                DY_html +=
                                    '<tr><td class = "DY_name1" ></td> <td class = "DY_score1" ></td> <td class = "DY_material1" > </td><td class = "DY_name2" > ' +
                                    DY_Data2[i]
                                    .a_name +
                                    '</td> <td class = "DY_score2" > ' +
                                    DY_Data2[i].score +
                                    '</td> <td class = "DY_material2" > </td> </tr>';
                            }
                            DY_total2 += DY_Data2[i].score;
                        }
                        if (DY_html != '') {
                            var DY_more_num = DY_more_num1 > DY_more_num2 ?
                                DY_more_num1 : DY_more_num2;
                            $('#DY').attr('rowspan', 4 + DY_more_num);
                            $(".DY_tr").eq(-1).after(DY_html);
                        }
                        $('#DY_total1').html(DY_total1);
                        $('#DY_total2').html(DY_total2);

                        //加载智育活动
                        ZY_html = '';
                        for (var i = 0; i < ZY_num1; i++) {
                            if (i < 3) {
                                $('.ZY_name1').eq(i).text(
                                    ZY_Data1[i].a_name);
                                $('.ZY_score1').eq(i).text(
                                    ZY_Data1[i].score);
                            } else {
                                ZY_more_num1++;
                                ZY_html += '<tr><td class = "ZY_name1" >' +
                                    ZY_Data1[
                                        i]
                                    .a_name +
                                    ' </td> <td class = "ZY_score1" > ' +
                                    ZY_Data1[
                                        i].score +
                                    '</td> <td class = "ZY_material1" > </td><td class = "ZY_name2" > </td> <td class = "ZY_score2" > </td> <td class = "ZY_material2" > </td> </tr>';
                            }
                            ZY_total1 += ZY_Data1[i].score;
                        }
                        for (var i = 0; i < ZY_num2; i++) {
                            if (i < 3) {
                                $('.ZY_name2').eq(i).text(
                                    ZY_Data2[i].a_name);
                                $('.ZY_score2').eq(i).text(
                                    ZY_Data2[i].score);
                            } else {
                                ZY_more_num2++;
                                ZY_html +=
                                    '<tr><td class = "ZY_name1" >< /td> <td class = "ZY_score1" ></td> <td class = "ZY_material1" > </td><td class = "ZY_name2" > ' +
                                    ZY_Data2[i]
                                    .a_name +
                                    '</td> <td class = "ZY_score2" > ' +
                                    ZY_Data2[i].score +
                                    '</td> <td class = "ZY_material2" > </td> </tr>';
                            }
                            ZY_total2 += ZY_Data2[i].score;
                        }
                        if (ZY_html != '') {
                            var ZY_more_num = ZY_more_num1 > ZY_more_num2 ?
                                ZY_more_num1 : ZY_more_num2;
                            $('#ZY').attr('rowspan', 4 + ZY_more_num);
                            $(".ZY_tr").eq(-1).after(ZY_html);
                        }
                        $('#ZY_total1').html(ZY_total1);
                        $('#ZY_total2').html(ZY_total2);

                        //加载体育活动
                        TY_html = '';
                        for (var i = 0; i < TY_num1; i++) {
                            if (i < 3) {
                                $('.TY_name1').eq(i).text(
                                    TY_Data1[i].a_name);
                                $('.TY_score1').eq(i).text(
                                    TY_Data1[i].score);
                            } else {
                                TY_more_num1++;
                                TY_html +=
                                    '<tr class="TY_tr"><td class = "TY_name1" >' +
                                    TY_Data1[
                                        i]
                                    .a_name +
                                    '</td> <td class = "TY_score1" > ' +
                                    TY_Data1[
                                        i].score +
                                    '</td> <td class = "TY_material1" > </td><td class = "TY_name2" > </td> <td class = "TY_score2" > </td> <td class = "TY_material2" > </td> </tr>';
                            }
                            TY_total1 += TY_Data1[i].score;
                        }
                        for (var i = 0; i < TY_num2; i++) {
                            if (i < 3) {
                                $('.TY_name2').eq(i).text(
                                    TY_Data2[i].a_name);
                                $('.TY_score2').eq(i).text(
                                    TY_Data2[i].score);
                            } else {
                                TY_more_num2++;
                                TY_html +=
                                    '<tr class="TY_tr"><td class = "TY_name1"></td> <td class = "TY_score1" ></td> <td class = "TY_material1" > </td><td class = "TY_name2" > ' +
                                    TY_Data2[i]
                                    .a_name +
                                    '</td> <td class = "TY_score2" > ' +
                                    TY_Data2[i].score +
                                    '</td> <td class = "TY_material2" > </td> </tr>';
                            }
                            TY_total2 += TY_Data2[i].score;
                        }
                        if (TY_html != '') {
                            var TY_more_num = TY_more_num1 > TY_more_num2 ?
                                TY_more_num1 : TY_more_num2;
                            $('#TY').attr('rowspan', 4 + TY_more_num);
                            $(".TY_tr").eq(-1).after(TY_html);
                        }
                        $('#TY_total1').html(TY_total1);
                        $('#TY_total2').html(TY_total2);

                        //加载美育活动
                        MY_html = '';
                        for (var i = 0; i < MY_num1; i++) {
                            if (i < 3) {
                                $('.MY_name1').eq(i).text(
                                    MY_Data1[i].a_name);
                                $('.MY_score1').eq(i).text(
                                    MY_Data1[i].score);
                            } else {
                                MY_more_num1++;
                                MY_html +=
                                    '<tr class="MY_tr"><td class = ".MY_name1" >' +
                                    MY_Data1[
                                        i]
                                    .a_name +
                                    ' </td> <td class = ".MY_score1" > ' +
                                    MY_Data1[
                                        i].score +
                                    '</td> <td class = "MY_material1" ></td><td class = "MY_name2" ></td> <td class = "MY_score2" > </td> <td class = "MY_material2" > </td> </tr>';
                            }
                            MY_total1 += MY_Data1[i].score;
                        }
                        for (var i = 0; i < MY_num2; i++) {
                            if (i < 3) {
                                $('.MY_name2').eq(i).text(
                                    MY_Data2[i].a_name);
                                $('.MY_score2').eq(i).text(
                                    MY_Data2[i].score);
                            } else {
                                MY_more_num2++;
                                MY_html +=
                                    '<tr class="MY_tr"><td class = "MY_name1"></td><td class = "MY_score1" ></td> <td class = "MY_material1" ></td><td class = "MY_name2" > ' +
                                    MY_Data2[i]
                                    .a_name +
                                    '</td> <td class = "MY_score2" > ' +
                                    MY_Data2[i].score +
                                    '</td> <td class = "MY_material2" > </td> </tr>';
                            }
                            MY_total2 += MY_Data2[i].score;
                        }
                        if (MY_html != '') {
                            var MY_more_num = MY_more_num1 > MY_more_num2 ?
                                MY_more_num1 : MY_more_num2;
                            $('#MY').attr('rowspan', 4 + MY_more_num);
                            $(".MY_tr").eq(-1).after(MY_html);
                        }
                        $('#MY_total1').html(MY_total1);
                        $('#MY_total2').html(MY_total2);
                        localStorage.setItem("SHZW_Data1", JSON.stringify(
                            SHZW_Data1));
                        localStorage.setItem("SHZW_Data2", JSON.stringify(
                            SHZW_Data2));
                        localStorage.setItem("DY_Data1", JSON.stringify(
                            DY_Data1));
                        localStorage.setItem("DY_Data2", JSON.stringify(
                            DY_Data2));
                        localStorage.setItem("ZY_Data1", JSON.stringify(
                            ZY_Data1));
                        localStorage.setItem("ZY_Data2", JSON.stringify(
                            ZY_Data2));
                        localStorage.setItem("TY_Data1", JSON.stringify(
                            TY_Data1));
                        localStorage.setItem("TY_Data2", JSON.stringify(
                            TY_Data2));
                        localStorage.setItem("MY_Data1", JSON.stringify(
                            MY_Data1));
                        localStorage.setItem("MY_Data2", JSON.stringify(
                            MY_Data2));
                        localStorage.setItem("LY_Data1", JSON.stringify(
                            LY_Data1));
                        localStorage.setItem("LY_Data2", JSON.stringify(
                            LY_Data2));
                        localStorage.setItem("KF_Data1", JSON.stringify(
                            KF_Data1));
                        localStorage.setItem("KF_Data2", JSON.stringify(
                            KF_Data2));
                        var T1 = SHZW_total1 +
                            SHZW_total2; //T1为社会职务加分，上限为25分
                        if (T1 >= 25)
                            T1 = 25;
                        var T2 = DY_total1 + DY_total2; //T2为德育加分，上限为30分
                        if (T2 >= 30)
                            T2 = 30;
                        var T3 = ZY_total1 + ZY_total2; //T3为智育(创新)加分，无上限
                        var T4_T5 = TY_total1 + TY_total2 + MY_total1 +
                            MY_total2; //T4为体育加分，T5为美育加分，T4 与T5总和的上限为50分
                        if (T4_T5 >= 50)
                            T4_T5 = 50;
                        var T6 = LY_total1 +
                            LY_total2; //T6为劳育加分，该项为附加分，上限为5分
                        if (T6 >= 5)
                            T6 = 5;
                        var T7 = Math.abs(KF_total1) + Math.abs(
                            KF_total2); //T7为扣分内容
                        var total = T1 + T2 + T3 + T4_T5 + T6 - T7;
                        if (total >= 100)
                            total = 100; //量化上限100
                        $('#total').html(total);
                        localStorage.setItem("status", 0);
                        data1 = {};
                        data1.status = 5;
                        data1.mode = 1;
                        data1.content = "重新填写量化表";
                        $.get('/form', data1, function (re) {
                            if (re == '1') {
                                layer.msg('已恢复初始量化表！');
                            }
                        })
                    });
                    layer.close(index);
                })
            });
            $(document).on('click', '.material', function () {
                var linkIndex = $('.material').index(this);
                var link = $('.link').eq(linkIndex).text();
                layer.open({
                    title: "查看证明材料",
                    area: ['640px', '440px'],
                    type: 1,
                    content: '<img src="' + link +
                        '" style="width:600px;margin:10px 5px 10px 20px"></img>'
                })
            });
            //打印量化表
            $('#print').on("click", function () {
                var newstr = $("#form").html();
                var re = new RegExp("margin-right: 150px;", "g");
                newstr = newstr.replace(re, "margin-right: 60px;");
                var oldstr = $('body').html();
                $('body').html(newstr);
                window.print();
                $('body').html(oldstr);
            });

            $('#writingBtn').on("click", function () {
                if (localStorage.getItem("status") == 0) {
                    var data = {};
                    data.status = 4;
                    data.refill = refill;
                    data.list = [];
                    SHZW_Data1 = localStorage.getItem("SHZW_Data1");
                    SHZW_Data1 = JSON.parse(SHZW_Data1);
                    SHZW_Data2 = localStorage.getItem("SHZW_Data2");
                    SHZW_Data2 = JSON.parse(SHZW_Data2);
                    DY_Data1 = localStorage.getItem("DY_Data1");
                    DY_Data1 = JSON.parse(DY_Data1);
                    DY_Data2 = localStorage.getItem("DY_Data2");
                    DY_Data2 = JSON.parse(DY_Data2);
                    ZY_Data1 = localStorage.getItem("ZY_Data1");
                    ZY_Data1 = JSON.parse(ZY_Data1);
                    ZY_Data2 = localStorage.getItem("ZY_Data2");
                    ZY_Data2 = JSON.parse(ZY_Data2);
                    TY_Data1 = localStorage.getItem("TY_Data1");
                    TY_Data1 = JSON.parse(TY_Data1);
                    TY_Data2 = localStorage.getItem("TY_Data2");
                    TY_Data2 = JSON.parse(TY_Data2);
                    MY_Data1 = localStorage.getItem("MY_Data1");
                    MY_Data1 = JSON.parse(MY_Data1);
                    MY_Data2 = localStorage.getItem("MY_Data2");
                    MY_Data2 = JSON.parse(MY_Data2);
                    LY_Data1 = localStorage.getItem("LY_Data1");
                    LY_Data1 = JSON.parse(LY_Data1);
                    LY_Data2 = localStorage.getItem("LY_Data2");
                    LY_Data2 = JSON.parse(LY_Data2);
                    KF_Data1 = localStorage.getItem("KF_Data1");
                    KF_Data1 = JSON.parse(KF_Data1);
                    KF_Data2 = localStorage.getItem("KF_Data2");
                    KF_Data2 = JSON.parse(KF_Data2);
                    for (var i = 0; i < SHZW_Data1.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = SHZW_Data1[i].a_name;
                        dataItem.score = SHZW_Data1[i].score;
                        dataItem.type = "社会职务";
                        dataItem.term = '1';
                        dataItem.proof = SHZW_Data1[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < SHZW_Data2.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = SHZW_Data2[i].a_name;
                        dataItem.score = SHZW_Data2[i].score;
                        dataItem.type = "社会职务";
                        dataItem.term = '2';
                        dataItem.proof = SHZW_Data2[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < DY_Data1.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = DY_Data1[i].a_name;
                        dataItem.score = DY_Data1[i].score;
                        dataItem.type = "德育";
                        dataItem.term = '1';
                        dataItem.proof = DY_Data1[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < DY_Data2.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = DY_Data2[i].a_name;
                        dataItem.score = DY_Data2[i].score;
                        dataItem.type = "德育";
                        dataItem.term = '2';
                        dataItem.proof = DY_Data2[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < ZY_Data1.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = ZY_Data1[i].a_name;
                        dataItem.score = ZY_Data1[i].score;
                        dataItem.type = "智育";
                        dataItem.term = '1';
                        dataItem.proof = ZY_Data1[i].proof;
                        data.list[count] = dataItem;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < ZY_Data2.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = ZY_Data2[i].a_name;
                        dataItem.score = ZY_Data2[i].score;
                        dataItem.type = "智育";
                        dataItem.term = '2';
                        dataItem.proof = ZY_Data2[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < TY_Data1.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = TY_Data1[i].a_name;
                        dataItem.score = TY_Data1[i].score;
                        dataItem.type = "体育";
                        dataItem.term = '1';
                        dataItem.proof = TY_Data1[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < TY_Data2.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = TY_Data2[i].a_name;
                        dataItem.score = TY_Data2[i].score;
                        dataItem.type = "体育";
                        dataItem.term = '2';
                        dataItem.proof = TY_Data2[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < MY_Data1.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = MY_Data1[i].a_name;
                        dataItem.score = MY_Data1[i].score;
                        dataItem.type = "美育";
                        dataItem.term = '1';
                        dataItem.proof = MY_Data1[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < MY_Data2.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = MY_Data2[i].a_name;
                        dataItem.score = MY_Data2[i].score;
                        dataItem.type = "美育";
                        dataItem.term = '2';
                        dataItem.proof = MY_Data2[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < LY_Data1.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = LY_Data1[i].a_name;
                        dataItem.score = LY_Data1[i].score;
                        dataItem.type = "劳育";
                        dataItem.term = '1';
                        dataItem.proof = LY_Data1[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < LY_Data2.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = LY_Data2[i].a_name;
                        dataItem.score = LY_Data2[i].score;
                        dataItem.type = "劳育";
                        dataItem.term = '2';
                        dataItem.proof = LY_Data2[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < KF_Data1.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = KF_Data1[i].a_name;
                        dataItem.score = KF_Data1[i].score;
                        dataItem.type = "扣分项目";
                        dataItem.term = '1';
                        dataItem.proof = KF_Data1[i].proof;
                        data.list.push(dataItem);
                    }
                    for (var i = 0; i < KF_Data2.length; i++) {
                        var dataItem = {
                            item_name: "",
                            score: "",
                            type: "",
                            term: "",
                            proof: ""
                        }; //每一项活动
                        dataItem.item_name = KF_Data2[i].a_name;
                        dataItem.score = KF_Data2[i].score;
                        dataItem.type = "扣分项目";
                        dataItem.term = '2';
                        dataItem.proof = KF_Data2[i].proof;
                        data.list.push(dataItem);
                        count++;
                    }
                    var index = layer.alert("您是否确认签字？", {
                        title: '签字提醒'
                    }, function () {
                        $.get('/form', data, function (re) {
                            if (re != '0') {
                                data1 = {};
                                data1.status = 5;
                                data1.mode = 1;
                                data1.content = "本人签字";
                                if (re == '1') {
                                    $.get('/form', data1, function (re) {
                                        if (re == '1') {
                                            localStorage.setItem("status", 1);
                                            var name = localStorage.getItem(
                                                "name");
                                            $('#self_writing').html(name);
                                            layer.msg('签字成功！');
                                        } else {
                                            layer.msg('签字失败！');
                                        }
                                    })
                                } else {
                                    layer.msg('签字失败！');
                                }
                            } else {
                                layer.msg('签字失败！');
                            }
                        })
                        layer.close(index);
                    });
                } else {
                    layer.msg('请勿重复签字！');
                }
            });
            $('#submitBtn').on('click', function () {
                if (localStorage.getItem("status") == 0)
                    layer.msg("请先完成签字！");
                else if (localStorage.getItem("status") == 1) {
                    var index = layer.alert("您是否确认提交？", {
                        title: '提交提醒'
                    }, function () {
                        $.get('/form', {
                            status: 6
                        }, function (re) {
                            if (re != '0') {
                                var ct_name = re.data.ct_name;
                                data1 = {};
                                data1.mode = 1;
                                data1.status = 5;
                                data1.content = "提交给班主任" + ct_name;
                                $.get('/form', data1, function (re) {
                                    if (re == '1') {
                                        localStorage.setItem("status", 2);
                                        layer.msg('提交成功！');
                                    } else {
                                        layer.msg('提交失败！');
                                    }
                                })
                            } else {
                                layer.msg('提交失败！');
                            }
                        })
                        layer.close(index);
                    });
                } else if (localStorage.getItem("status") == 2) {
                    layer.msg('请勿重复提交！');
                }
            });
            //监听提交
            form.on('submit(saveBtn)', function (data) {
                data = data.field;
                data.actimg = url;
                data.username = username;
                if (url == '')
                    layer.msg('请上传证明材料！');
                else {
                    if (item_type == "KF" && data.item_score >= 0)
                        layer.msg('量化分值应为负数！');
                    else {
                        addnum++;
                        if (data.term == '第一学期') {
                            if (item_num1 <= 2) {
                                $('.' + item_type + '_name1').eq(item_num1).html(
                                    data.item_name);
                                $('.' + item_type + '_score1').eq(item_num1).html(
                                    data.item_score);
                                $('.' + item_type + '_material1').eq(item_num1).html(
                                    '<a class="material">V' + addnum +
                                    '<span class="link" style="display:none">' + url + '</span></a>'
                                );
                            } else {
                                var item_html =
                                    '<tr class="' + item_type + '_tr"><td class="' + item_type +
                                    '_name1">' + data.item_name +
                                    '</td><td class="' + item_type + '_score1">' + data.item_score +
                                    '</td><td class="' + item_type +
                                    '_material1"><a class="material">V' +
                                    addnum +
                                    '<span class="link" style="display:none">' + url +
                                    '</span></a></td><td class="' + item_type +
                                    '_name2"></td><td class="' +
                                    item_type + '_score2"></td><td class="' + item_type +
                                    '_material2"></td></tr>';
                                var nrow = parseInt($('#' + item_type).attr('rowspan'));
                                $('#' + item_type).attr('rowspan', nrow + 1);
                                $('.' + item_type + '_tr').eq(-1).after(item_html);
                            }
                            var dataItem = {
                                a_name: '',
                                score: '',
                                proof: ''
                            };
                            dataItem.a_name = data.item_name;
                            dataItem.score = data.item_score;
                            sno = localStorage.getItem("sno");
                            dataItem.proof = sno + "_V" + addnum;
                            localStorage.setItem(sno + "_V" + addnum, url);
                            if (item_type == "SHZW") {
                                SHZW_Data1[SHZW_num1] = dataItem;
                                SHZW_num1++;
                                localStorage.setItem("SHZW_Data1", JSON.stringify(SHZW_Data1));
                            } else if (item_type == "DY") {
                                DY_Data1[DY_num1] = dataItem;
                                DY_num1++;
                                localStorage.setItem("DY_Data1", JSON.stringify(DY_Data1));
                            } else if (item_type == "ZY") {
                                ZY_Data1[ZY_num1] = dataItem;
                                ZY_num1++;
                                localStorage.setItem("ZY_Data1", JSON.stringify(ZY_Data1));
                            } else if (item_type == "TY") {
                                TY_Data1[TY_num1] = dataItem;
                                TY_num1++;
                                localStorage.setItem("TY_Data1", JSON.stringify(TY_Data1));
                            } else if (item_type == "MY") {
                                MY_Data1[MY_num1] = dataItem;
                                MY_num1++;
                                localStorage.setItem("MY_Data1", JSON.stringify(MY_Data1));
                            } else if (item_type == "LY") {
                                LY_Data1[LY_num1] = dataItem;
                                LY_num1++;
                                localStorage.setItem("LY_Data1", JSON.stringify(LY_Data1));
                            } else if (item_type == "KF") {
                                KF_Data1[KF_num1] = dataItem;
                                KF_num1++;
                                localStorage.setItem("KF_Data1", JSON.stringify(KF_Data1));
                            }
                            item_num1++;
                            if (item_type != "KF") {
                                item_total1 = parseInt($('#' + item_type + '_total1').html()) +
                                    parseInt(
                                        data.item_score);
                                total = parseInt($('#total').html()) + parseInt(data.item_score);
                            } else {
                                item_total1 = parseInt($('#' + item_type + '_total1').html()) - Math
                                    .abs(
                                        parseInt(data.item_score));
                                total = parseInt($('#total').html()) - Math.abs(parseInt(data
                                    .item_score));
                            }

                            $('#' + item_type + '_total1').html(item_total1);
                            if (total > 100)
                                total = 100;
                            $('#total').html(total);
                        } else {
                            if (item_num2 <= 2) {
                                $('.' + item_type + '_name2').eq(item_num2).html(
                                    data.item_name);
                                $('.' + item_type + '_score2').eq(item_num2).html(
                                    data.item_score);
                                $('.' + item_type + '_material2').eq(item_num2).html(
                                    '<a class="material">V' + addnum +
                                    '<span class="link" style="display:none">' + url + '</span></a>'
                                );
                            } else {
                                var item_html =
                                    '<tr class="' + item_type + '_tr"><td class="' + item_type +
                                    '_name1"></td><td class="' + item_type +
                                    '_score1"></td><td class="' +
                                    item_type + '_material1"></td><td class="' + item_type +
                                    '_name2">' +
                                    data.item_name +
                                    '</td><td class="' + item_type + '_score2">' + data.item_score +
                                    '</td><td class="' + item_type +
                                    '_material2"><a class="material">V' +
                                    addnum +
                                    '<span class="link" style="display:none">' + url +
                                    '</span></a></td></tr>';
                                var nrow = parseInt($('#' + item_type).attr('rowspan'));
                                $('#' + item_type).attr('rowspan', nrow + 1);
                                $('.' + item_type + '_tr').eq(-1).after(item_html);
                            }
                            var dataItem = {
                                a_name: '',
                                score: '',
                                proof: ''
                            };
                            dataItem.a_name = data.item_name;
                            dataItem.score = data.item_score;
                            sno = localStorage.getItem("sno");
                            dataItem.proof = sno + "_V" + addnum;
                            localStorage.setItem(sno + "_V" + addnum, url);
                            if (item_type == "SHZW") {
                                SHZW_Data2[SHZW_num2] = dataItem;
                                SHZW_num2++;
                                localStorage.setItem("SHZW_Data2", JSON.stringify(SHZW_Data2));
                            } else if (item_type == "DY") {
                                DY_Data2[DY_num2] = dataItem;
                                DY_num2++;
                                localStorage.setItem("DY_Data2", JSON.stringify(DY_Data2));
                            } else if (item_type == "ZY") {
                                ZY_Data2[ZY_num2] = dataItem;
                                ZY_num2++;
                                localStorage.setItem("ZY_Data2", JSON.stringify(ZY_Data2));
                            } else if (item_type == "TY") {
                                TY_Data2[TY_num2] = dataItem;
                                TY_num2++;
                                localStorage.setItem("TY_Data2", JSON.stringify(TY_Data2));
                            } else if (item_type == "MY") {
                                MY_Data2[MY_num2] = dataItem;
                                MY_num2++;
                                localStorage.setItem("MY_Data2", JSON.stringify(MY_Data2));
                            } else if (item_type == "LY") {
                                LY_Data2[LY_num2] = dataItem;
                                LY_num2++;
                                localStorage.setItem("LY_Data2", JSON.stringify(LY_Data2));
                            } else if (item_type == "KF") {
                                KF_Data2[KF_num2] = dataItem;
                                KF_num2++;
                                localStorage.setItem("KF_Data2", JSON.stringify(KF_Data2));
                            }
                            item_num2++;
                            item_total2 = parseInt($('#' + item_type + '_total2').html()) + parseInt(
                                data
                                .item_score);
                            $('#' + item_type + '_total2').html(item_total2);
                            total = parseInt($('#total').html()) + parseInt(data.item_score);
                            if (total > 100)
                                total = 100;
                            $('#total').html(total);
                        }
                    }
                }
                var layerIndex = localStorage.getItem('layerIndex');
                layer.close(layerIndex);
                return false;
            });
            $(document).on("click", '.type', function () {
                index = $('.type').index(this);
                var title = '';
                var item_name = '';
                if (localStorage.getItem("status") == 0) {
                    if (index == '0') {
                        title = '增加社会职务';
                        item_name = '社会职务';
                        item_type = "SHZW";
                        item_num1 = SHZW_num1;
                        item_num2 = SHZW_num2;
                        item_total1 = SHZW_total1;
                        item_total2 = SHZW_total2;
                    } else if (index == '1') {
                        title = '增加德育活动';
                        item_name = '活动名称';
                        item_type = "DY";
                        item_num1 = DY_num1;
                        item_num2 = DY_num2;
                        item_total1 = DY_total1;
                        item_total2 = DY_total2;
                    } else if (index == '2') {
                        item_name = '活动名称';
                        title = '增加智育活动';
                        item_type = "ZY";
                        item_num1 = ZY_num1;
                        item_num2 = ZY_num2;
                        item_total1 = ZY_total1;
                        item_total2 = ZY_total2;
                    } else if (index == '3') {
                        item_name = '活动名称';
                        title = '增加体育活动';
                        item_type = "TY";
                        item_num1 = TY_num1;
                        item_num2 = TY_num2;
                        item_total1 = TY_total1;
                        item_total2 = TY_total2;
                    } else if (index == '4') {
                        item_name = '活动名称';
                        title = '增加美育活动';
                        item_type = "MY";
                        item_num1 = MY_num1;
                        item_num2 = MY_num2;
                        item_total1 = MY_total1;
                        item_total2 = MY_total2;
                    } else if (index == '5') {
                        item_name = '活动名称';
                        title = '增加劳育活动';
                        item_type = "LY";
                        item_num1 = LY_num1;
                        item_num2 = LY_num2;
                        item_total1 = LY_total1;
                        item_total2 = LY_total2;
                    } else if (index == '6') {
                        item_name = '扣分项目';
                        title = '增加扣分项目';
                        item_type = "KF";
                        item_num1 = KF_num1;
                        item_num2 = KF_num2;
                        item_total1 = KF_total1;
                        item_total2 = KF_total2;
                    }
                    var input_item_name =
                        '<div class="layui-form-item"><label class="layui-form-label required">' +
                        item_name +
                        '<span style="color:red;margin-left: 4px;font-weight: bold;line-height: 1.8em;top: 6px;right: 5px;">*</span></label><div class="layui-input-block"><input type="text" name="item_name" lay-verify="required" lay-reqtext="' +
                        item_name + '不能为空" placeholder="请输入' + item_name +
                        '" value="" class="layui-input"></div></div>';
                    var input_item_score =
                        '<div class="layui-form-item"><label class="layui-form-label required">量化分值<span style="color:red;margin-left: 4px;font-weight: bold;line-height: 1.8em;top: 6px;right: 5px;">*</span></label><div class="layui-input-block"><input type="text" name="item_score" lay-verify="required" lay-reqtext="量化分值不能为空" placeholder="请输入量化分值" value="" class="layui-input"></div></div>';
                    var zmcl =
                        '<div class="layui-form-item"><label class="layui-form-label required">证明材料<span style="color:red;margin-left: 4px;font-weight: bold;line-height: 1.8em;top: 6px;right: 5px;">*</span></label><button type="button" class="layui-btn layui-btn-warm layui-btn-sm" id="upimg" style="display: inline-block;vertical-align: middle;">+上传图片</button><input class="layui-upload-file" type="file" accept="" name="file"><div class="layui-upload-list" style="display: inline-block;vertical-align: middle;width: 300px;height: 180px;border-radius: 0px;border:1px dashed #FCBF5B"><img src="https://s2.loli.net/2022/05/09/Ll6HgRqM89FaVY5.png" id="demo1"style = "width: 300px;height: 180px;border:none;border-radius: 0px;" > <p id = "demoText"> </p></div></div>';
                    var chooseterm =
                        '<div class="layui-form-item"><label class="layui-form-label">所在学期<span style="color:red;margin-left: 4px;font-weight: bold;line-height: 1.8em;top: 6px;right: 5px;">*</span></label><div class="layui-input-block"><input type="radio" name="term" value="第一学期" title="第一学期"  checked><input type="radio" name="term" value="第二学期" title="第二学期"></div></div>';
                    var confirm =
                        '<div class="layui-input-inline"><button id="addItem" class="layui-btn layui-btn-normal" style="vertical-align: middle;background-color:#4D67F8;margin:15px 195px" lay-filter="saveBtn" lay-submit>确定</button></div>';
                    layer.open({
                        title: title,
                        area: ['500px', '400px'],
                        type: 1,
                        content: ' <form class="layui-form" action="" style="margin:20px">' +
                            input_item_name + input_item_score + chooseterm + zmcl + confirm +
                            '</form>',
                        success: function (layero, index) {
                            // 重新渲染
                            form.render();
                            var uploadInst = upload.render({
                                elem: '#upimg',
                                size: 10000,
                                accept: 'images',
                                acceptMime: 'image/*',
                                auto: false, // 取消自动提交
                                bindAction: "#upimg", //确认上传按钮
                                field: "actimg", //上传的图片part名称
                                choose: function (obj) {
                                    //预读本地文件示例，不支持ie8
                                    obj.preview(function (index, file, result) {
                                        $('#demo1').attr('src',
                                            result); //图片链接（base64）
                                        url = result;
                                        console.log(result);
                                    });
                                }
                            });
                            localStorage.setItem('layerIndex', index);
                        }
                    })
                } else {
                    layer.msg("您已签字或提交，无法进行更改！");
                }
            });
            $(function () {
                var html = $('#table').html();
                var re = new RegExp("\n                ", "g");
                html = html.replace(re, "");
                html = html.replace("<tbody>", "");
                html = html.replace("</tbody>", "");
                var re2 = new RegExp("    ", "g");
                html = html.replace(re2, "");
                html = html.replace("\n", "");
                localStorage.setItem('html', html);
                $.get('/form', {
                    status: 0, //加载基本信息
                }, function (re) {
                    var year = new Date().getFullYear();
                    var oldyear = parseInt(year) - 1;
                    $('#college').text(re.data.college_name);
                    $('#year').text('' + oldyear + '-' + year + '学年');
                    $('#class').text(re.data.class);
                    $('#name').text(re.data.s_name);
                    $('#sno').text(re.data.s_id);
                    localStorage.setItem("sno", re.data.s_id);
                    localStorage.setItem("teacher", re.data.ct_name);
                })
                $.get('/form', {
                    status: 1, //判断本年是否填写量化表
                }, function (re) {
                    if (re == '0') {
                        $.get('/form', {
                            status: 2, //加载初始量化表
                        }, function (re) {
                            if (re != '-1') {
                                $('#SHZW_total1').html(SHZW_total1);
                                $('#SHZW_total2').html(SHZW_total2);
                                $('#KF_total1').html(KF_total1);
                                $('#KF_total2').html(KF_total2);
                                $('#LY_total1').html(MY_total1);
                                $('#LY_total2').html(MY_total2);
                                for (var i = 0; i < re.data.length; i++) {
                                    if (re.data[i].type == '德育') {
                                        var dataItem = {
                                            a_name: '',
                                            score: '',
                                            proof: ''
                                        };
                                        dataItem.a_name = re.data[i].a_name;
                                        dataItem.score = re.data[i].score;
                                        if (re.data[i].term == '1') {
                                            DY_Data1[DY_num1] = dataItem;
                                            DY_num1++;
                                        } else if (re.data[i].term == '2') {
                                            DY_Data2[DY_num2] = dataItem;
                                            DY_num2++;
                                        }
                                    } else if (re.data[i].type == '美育') {
                                        var dataItem = {
                                            a_name: '',
                                            score: '',
                                            proof: ''
                                        };
                                        dataItem.a_name = re.data[i].a_name;
                                        dataItem.score = re.data[i].score;
                                        if (re.data[i].term == '1') {
                                            MY_Data1[MY_num1] = dataItem;
                                            MY_num1++;
                                        } else if (re.data[i].term == '2') {
                                            MY_Data2[MY_num2] = dataItem;
                                            MY_num2++;
                                        }
                                    } else if (re.data[i].type == '智育') {
                                        var dataItem = {
                                            a_name: '',
                                            score: '',
                                            proof: ''
                                        };
                                        dataItem.a_name = re.data[i].a_name;
                                        dataItem.score = re.data[i].score;
                                        if (re.data[i].term == '1') {
                                            ZY_Data1[ZY_num1] = dataItem;
                                            ZY_num1++;
                                        } else if (re.data[i].term == '2') {
                                            ZY_Data2[ZY_num2] = dataItem;
                                            ZY_num2++;
                                        }
                                    } else if (re.data[i].type == '体育') {
                                        var dataItem = {
                                            a_name: '',
                                            score: '',
                                            proof: ''
                                        };
                                        dataItem.a_name = re.data[i].a_name;
                                        dataItem.score = re.data[i].score;
                                        if (re.data[i].term == '1') {
                                            TY_Data1[TY_num1] = dataItem;
                                            TY_num1++;
                                        } else if (re.data[i].term == '2') {
                                            TY_Data2[TY_num2] = dataItem;
                                            TY_num2++;
                                        }
                                    }
                                }
                                //加载德育活动
                                DY_html = '';
                                for (var i = 0; i < DY_num1; i++) {
                                    if (i < 3) {
                                        $('.DY_name1').eq(i).html(
                                            DY_Data1[i].a_name);
                                        $('.DY_score1').eq(i).html(
                                            DY_Data1[i].score);
                                    } else {
                                        DY_more_num1++;
                                        DY_html += '<tr><td class = "DY_name1" >' +
                                            DY_Data1[
                                                i]
                                            .a_name +
                                            ' </td> <td class = "DY_score1" > ' +
                                            DY_Data1[
                                                i].score +
                                            '</td> <td class = "DY_material1" > </td><td class = "DY_name2" > </td> <td class = "DY_score2" > </td> <td class = "DY_material2" > </td> </tr>';
                                    }
                                    DY_total1 += DY_Data1[i].score;
                                }
                                for (var i = 0; i < DY_num2; i++) {
                                    if (i < 3) {
                                        $('.DY_name2').eq(i).html(
                                            DY_Data2[i].a_name);
                                        $('.DY_score2').eq(i).html(
                                            DY_Data2[i].score);
                                    } else {
                                        DY_more_num2++;
                                        DY_html +=
                                            '<tr><td class = "DY_name1" ></td> <td class = "DY_score1" ></td> <td class = "DY_material1" > </td><td class = "DY_name2" > ' +
                                            DY_Data2[i]
                                            .a_name +
                                            '</td> <td class = "DY_score2" > ' +
                                            DY_Data2[i].score +
                                            '</td> <td class = "DY_material2" > </td> </tr>';
                                    }
                                    DY_total2 += DY_Data2[i].score;
                                }
                                if (DY_html != '') {
                                    var DY_more_num = DY_more_num1 > DY_more_num2 ?
                                        DY_more_num1 : DY_more_num2;
                                    $('#DY').attr('rowspan', 4 + DY_more_num);
                                    $(".DY_tr").eq(-1).after(DY_html);
                                }
                                $('#DY_total1').html(DY_total1);
                                $('#DY_total2').html(DY_total2);

                                //加载智育活动
                                ZY_html = '';
                                for (var i = 0; i < ZY_num1; i++) {
                                    if (i < 3) {
                                        $('.ZY_name1').eq(i).text(
                                            ZY_Data1[i].a_name);
                                        $('.ZY_score1').eq(i).text(
                                            ZY_Data1[i].score);
                                    } else {
                                        ZY_more_num1++;
                                        ZY_html += '<tr><td class = "ZY_name1" >' +
                                            ZY_Data1[
                                                i]
                                            .a_name +
                                            ' </td> <td class = "ZY_score1" > ' +
                                            ZY_Data1[
                                                i].score +
                                            '</td> <td class = "ZY_material1" > </td><td class = "ZY_name2" > </td> <td class = "ZY_score2" > </td> <td class = "ZY_material2" > </td> </tr>';
                                    }
                                    ZY_total1 += ZY_Data1[i].score;
                                }
                                for (var i = 0; i < ZY_num2; i++) {
                                    if (i < 3) {
                                        $('.ZY_name2').eq(i).text(
                                            ZY_Data2[i].a_name);
                                        $('.ZY_score2').eq(i).text(
                                            ZY_Data2[i].score);
                                    } else {
                                        ZY_more_num2++;
                                        ZY_html +=
                                            '<tr><td class = "ZY_name1" >< /td> <td class = "ZY_score1" ></td> <td class = "ZY_material1" > </td><td class = "ZY_name2" > ' +
                                            ZY_Data2[i]
                                            .a_name +
                                            '</td> <td class = "ZY_score2" > ' +
                                            ZY_Data2[i].score +
                                            '</td> <td class = "ZY_material2" > </td> </tr>';
                                    }
                                    ZY_total2 += ZY_Data2[i].score;
                                }
                                if (ZY_html != '') {
                                    var ZY_more_num = ZY_more_num1 > ZY_more_num2 ?
                                        ZY_more_num1 : ZY_more_num2;
                                    $('#ZY').attr('rowspan', 4 + ZY_more_num);
                                    $(".ZY_tr").eq(-1).after(ZY_html);
                                }
                                $('#ZY_total1').html(ZY_total1);
                                $('#ZY_total2').html(ZY_total2);

                                //加载体育活动
                                TY_html = '';
                                for (var i = 0; i < TY_num1; i++) {
                                    if (i < 3) {
                                        $('.TY_name1').eq(i).text(
                                            TY_Data1[i].a_name);
                                        $('.TY_score1').eq(i).text(
                                            TY_Data1[i].score);
                                    } else {
                                        TY_more_num1++;
                                        TY_html +=
                                            '<tr class="TY_tr"><td class = "TY_name1" >' +
                                            TY_Data1[
                                                i]
                                            .a_name +
                                            '</td> <td class = "TY_score1" > ' +
                                            TY_Data1[
                                                i].score +
                                            '</td> <td class = "TY_material1" > </td><td class = "TY_name2" > </td> <td class = "TY_score2" > </td> <td class = "TY_material2" > </td> </tr>';
                                    }
                                    TY_total1 += TY_Data1[i].score;
                                }
                                for (var i = 0; i < TY_num2; i++) {
                                    if (i < 3) {
                                        $('.TY_name2').eq(i).text(
                                            TY_Data2[i].a_name);
                                        $('.TY_score2').eq(i).text(
                                            TY_Data2[i].score);
                                    } else {
                                        TY_more_num2++;
                                        TY_html +=
                                            '<tr class="TY_tr"><td class = "TY_name1"></td> <td class = "TY_score1" ></td> <td class = "TY_material1" > </td><td class = "TY_name2" > ' +
                                            TY_Data2[i]
                                            .a_name +
                                            '</td> <td class = "TY_score2" > ' +
                                            TY_Data2[i].score +
                                            '</td> <td class = "TY_material2" > </td> </tr>';
                                    }
                                    TY_total2 += TY_Data2[i].score;
                                }
                                if (TY_html != '') {
                                    var TY_more_num = TY_more_num1 > TY_more_num2 ?
                                        TY_more_num1 : TY_more_num2;
                                    $('#TY').attr('rowspan', 4 + TY_more_num);
                                    $(".TY_tr").eq(-1).after(TY_html);
                                }
                                $('#TY_total1').html(TY_total1);
                                $('#TY_total2').html(TY_total2);

                                //加载美育活动
                                MY_html = '';
                                for (var i = 0; i < MY_num1; i++) {
                                    if (i < 3) {
                                        $('.MY_name1').eq(i).text(
                                            MY_Data1[i].a_name);
                                        $('.MY_score1').eq(i).text(
                                            MY_Data1[i].score);
                                    } else {
                                        MY_more_num1++;
                                        MY_html +=
                                            '<tr class="MY_tr"><td class = ".MY_name1" >' +
                                            MY_Data1[
                                                i]
                                            .a_name +
                                            ' </td> <td class = ".MY_score1" > ' +
                                            MY_Data1[
                                                i].score +
                                            '</td> <td class = "MY_material1" ></td><td class = "MY_name2" ></td> <td class = "MY_score2" > </td> <td class = "MY_material2" > </td> </tr>';
                                    }
                                    MY_total1 += MY_Data1[i].score;
                                }
                                for (var i = 0; i < MY_num2; i++) {
                                    if (i < 3) {
                                        $('.MY_name2').eq(i).text(
                                            MY_Data2[i].a_name);
                                        $('.MY_score2').eq(i).text(
                                            MY_Data2[i].score);
                                    } else {
                                        MY_more_num2++;
                                        MY_html +=
                                            '<tr class="MY_tr"><td class = "MY_name1"></td><td class = "MY_score1" ></td> <td class = "MY_material1" ></td><td class = "MY_name2" > ' +
                                            MY_Data2[i]
                                            .a_name +
                                            '</td> <td class = "MY_score2" > ' +
                                            MY_Data2[i].score +
                                            '</td> <td class = "MY_material2" > </td> </tr>';
                                    }
                                    MY_total2 += MY_Data2[i].score;
                                }
                                if (MY_html != '') {
                                    var MY_more_num = MY_more_num1 > MY_more_num2 ?
                                        MY_more_num1 : MY_more_num2;
                                    $('#MY').attr('rowspan', 4 + MY_more_num);
                                    $(".MY_tr").eq(-1).after(MY_html);
                                }
                                $('#MY_total1').html(MY_total1);
                                $('#MY_total2').html(MY_total2);
                                localStorage.setItem("SHZW_Data1", JSON.stringify(
                                    SHZW_Data1));
                                localStorage.setItem("SHZW_Data2", JSON.stringify(
                                    SHZW_Data2));
                                localStorage.setItem("DY_Data1", JSON.stringify(
                                    DY_Data1));
                                localStorage.setItem("DY_Data2", JSON.stringify(
                                    DY_Data2));
                                localStorage.setItem("ZY_Data1", JSON.stringify(
                                    ZY_Data1));
                                localStorage.setItem("ZY_Data2", JSON.stringify(
                                    ZY_Data2));
                                localStorage.setItem("TY_Data1", JSON.stringify(
                                    TY_Data1));
                                localStorage.setItem("TY_Data2", JSON.stringify(
                                    TY_Data2));
                                localStorage.setItem("MY_Data1", JSON.stringify(
                                    MY_Data1));
                                localStorage.setItem("MY_Data2", JSON.stringify(
                                    MY_Data2));
                                localStorage.setItem("LY_Data1", JSON.stringify(
                                    LY_Data1));
                                localStorage.setItem("LY_Data2", JSON.stringify(
                                    LY_Data2));
                                localStorage.setItem("KF_Data1", JSON.stringify(
                                    KF_Data1));
                                localStorage.setItem("KF_Data2", JSON.stringify(
                                    KF_Data2));
                                var T1 = SHZW_total1 +
                                    SHZW_total2; //T1为社会职务加分，上限为25分
                                if (T1 >= 25)
                                    T1 = 25;
                                var T2 = DY_total1 + DY_total2; //T2为德育加分，上限为30分
                                if (T2 >= 30)
                                    T2 = 30;
                                var T3 = ZY_total1 + ZY_total2; //T3为智育(创新)加分，无上限
                                var T4_T5 = TY_total1 + TY_total2 + MY_total1 +
                                    MY_total2; //T4为体育加分，T5为美育加分，T4 与T5总和的上限为50分
                                if (T4_T5 >= 50)
                                    T4_T5 = 50;
                                var T6 = LY_total1 +
                                    LY_total2; //T6为劳育加分，该项为附加分，上限为5分
                                if (T6 >= 5)
                                    T6 = 5;
                                var T7 = Math.abs(KF_total1) + Math.abs(
                                    KF_total2); //T7为扣分内容
                                var total = T1 + T2 + T3 + T4_T5 + T6 - T7;
                                if (total >= 100)
                                    total = 100; //量化上限100
                                $('#total').html(total);
                            }
                        })
                    } else {
                        var status = parseInt(re);
                        localStorage.setItem("status", status);
                        $.get('/form', {
                            status: 3, //加载填写的量化表
                        }, function (re) {
                            for (var i = 0; i < re.data.length; i++) {
                                if (re.data[i].type == '社会职务') {
                                    var dataItem = {
                                        item_name: '',
                                        score: '',
                                        proof: '',
                                        key: ''
                                    };
                                    dataItem.item_name = re.data[i].item_name;
                                    dataItem.score = re.data[i].score;
                                    if (re.data[i].proof != "") {
                                        dataItem.key = re.data[i].proof;
                                        dataItem.proof = localStorage.getItem(dataItem
                                            .key);
                                        dataItem.key = dataItem.key.split('_')[1];
                                    }
                                    if (re.data[i].term == '1') {
                                        SHZW_Data1[SHZW_num1] = dataItem;
                                        SHZW_num1++;
                                    } else if (re.data[i].term == '2') {
                                        SHZW_Data2[SHZW_num2] = dataItem;
                                        SHZW_num2++;
                                    }
                                } else if (re.data[i].type == '德育') {
                                    var dataItem = {
                                        item_name: '',
                                        score: '',
                                        proof: '',
                                        key: ''
                                    };
                                    dataItem.item_name = re.data[i].item_name;
                                    dataItem.score = re.data[i].score;
                                    if (re.data[i].proof != "") {
                                        dataItem.key = re.data[i].proof;
                                        dataItem.proof = localStorage.getItem(dataItem
                                            .key);
                                        dataItem.key = dataItem.key.split('_')[1];
                                    }
                                    if (re.data[i].term == '1') {
                                        DY_Data1[DY_num1] = dataItem;
                                        DY_num1++;
                                    } else if (re.data[i].term == '2') {
                                        DY_Data2[DY_num2] = dataItem;
                                        DY_num2++;
                                    }
                                } else if (re.data[i].type == '美育') {
                                    var dataItem = {
                                        item_name: '',
                                        score: '',
                                        proof: '',
                                        key: ''
                                    };
                                    dataItem.item_name = re.data[i].item_name;
                                    dataItem.score = re.data[i].score;
                                    if (re.data[i].proof != "") {
                                        dataItem.key = re.data[i].proof;
                                        dataItem.proof = localStorage.getItem(dataItem
                                            .key);
                                        dataItem.key = dataItem.key.split('_')[1];
                                    }
                                    if (re.data[i].term == '1') {
                                        MY_Data1[MY_num1] = dataItem;
                                        MY_num1++;
                                    } else if (re.data[i].term == '2') {
                                        MY_Data2[MY_num2] = dataItem;
                                        MY_num2++;
                                    }
                                } else if (re.data[i].type == '智育') {
                                    var dataItem = {
                                        item_name: '',
                                        score: '',
                                        proof: '',
                                        key: ''
                                    };
                                    dataItem.item_name = re.data[i].item_name;
                                    dataItem.score = re.data[i].score;
                                    if (re.data[i].proof != "") {
                                        dataItem.key = re.data[i].proof;
                                        dataItem.proof = localStorage.getItem(dataItem
                                            .key);
                                        dataItem.key = dataItem.key.split('_')[1];
                                    }
                                    if (re.data[i].term == '1') {
                                        ZY_Data1[ZY_num1] = dataItem;
                                        ZY_num1++;
                                    } else if (re.data[i].term == '2') {
                                        ZY_Data2[ZY_num2] = dataItem;
                                        ZY_num2++;
                                    }
                                } else if (re.data[i].type == '体育') {
                                    var dataItem = {
                                        item_name: '',
                                        score: '',
                                        proof: '',
                                        key: ''
                                    };
                                    dataItem.item_name = re.data[i].item_name;
                                    dataItem.score = re.data[i].score;
                                    if (re.data[i].proof != "") {
                                        dataItem.key = re.data[i].proof;
                                        dataItem.proof = localStorage.getItem(dataItem
                                            .key);
                                        dataItem.key = dataItem.key.split('_')[1];
                                    }
                                    if (re.data[i].term == '1') {
                                        TY_Data1[TY_num1] = dataItem;
                                        TY_num1++;
                                    } else if (re.data[i].term == '2') {
                                        TY_Data2[TY_num2] = dataItem;
                                        TY_num2++;
                                    }
                                } else if (re.data[i].type == '劳育') {
                                    var dataItem = {
                                        item_name: '',
                                        score: '',
                                        proof: '',
                                        key: ''
                                    };
                                    dataItem.item_name = re.data[i].item_name;
                                    dataItem.score = re.data[i].score;
                                    if (re.data[i].proof != "") {
                                        dataItem.key = re.data[i].proof;
                                        dataItem.proof = localStorage.getItem(dataItem
                                            .key);
                                        dataItem.key = dataItem.key.split('_')[1];
                                    }
                                    if (re.data[i].term == '1') {
                                        LY_Data1[LY_num1] = dataItem;
                                        LY_num1++;
                                    } else if (re.data[i].term == '2') {
                                        LY_Data2[LY_num2] = dataItem;
                                        LY_num2++;
                                    }
                                } else if (re.data[i].type == '扣分项目') {
                                    var dataItem = {
                                        item_name: '',
                                        score: '',
                                        proof: '',
                                        key: ''
                                    };
                                    dataItem.item_name = re.data[i].item_name;
                                    dataItem.score = re.data[i].score;
                                    if (re.data[i].proof != "") {
                                        dataItem.key = re.data[i].proof;
                                        dataItem.proof = localStorage.getItem(dataItem
                                            .key);
                                        dataItem.key = dataItem.key.split('_')[1];
                                    }
                                    if (re.data[i].term == '1') {
                                        KF_Data1[KF_num1] = dataItem;
                                        KF_num1++;
                                    } else if (re.data[i].term == '2') {
                                        KF_Data2[KF_num2] = dataItem;
                                        KF_num2++;
                                    }
                                }
                            }
                            //加载社会职务
                            SHZW_html = '';
                            for (var i = 0; i < SHZW_num1; i++) {
                                if (i < 3) {
                                    $('.SHZW_name1').eq(i).html(
                                        SHZW_Data1[i].item_name);
                                    $('.SHZW_score1').eq(i).html(
                                        SHZW_Data1[i].score);
                                    $('.SHZW_material1').eq(i).html(
                                        '<a class="material" >' +
                                        SHZW_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        SHZW_Data1[i].proof +
                                        '</span></a> ');
                                } else {
                                    SHZW_more_num1++;
                                    SHZW_html += '<tr><td class = "SHZW_name1" >' +
                                        SHZW_Data1[
                                            i]
                                        .item_name +
                                        ' </td> <td class = "SHZW_score1" > ' +
                                        SHZW_Data1[
                                            i].score +
                                        '</td> <td class = "SHZW_material1" ><a class="material" >' +
                                        SHZW_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        SHZW_Data1[i].proof +
                                        '</span></a> </td><td class = "SHZW_name2" > </td> <td class = "SHZW_score2" > </td> <td class = "SHZW_material2" > </td> </tr>';
                                }
                                SHZW_total1 += SHZW_Data1[i].score;
                            }
                            for (var i = 0; i < SHZW_num2; i++) {
                                if (i < 3) {
                                    $('.SHZW_name2').eq(i).html(
                                        SHZW_Data2[i].item_name);
                                    $('.SHZW_score2').eq(i).html(
                                        SHZW_Data2[i].score);
                                    $('.SHZW_material2').eq(i).html(
                                        '<a class="material" >' +
                                        SHZW_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        SHZW_Data2[i].proof +
                                        '</span></a> ');
                                } else {
                                    SHZW_more_num2++;
                                    SHZW_html +=
                                        '<tr><td class = "SHZW_name1" ></td> <td class = "SHZW_score1" ></td> <td class = "SHZW_material1" > </td><td class = "SHZW_name2" > ' +
                                        SHZW_Data2[i]
                                        .item_name +
                                        '</td> <td class = "SHZW_score2" > ' +
                                        SHZW_Data2[i].score +
                                        '</td> <td class = "SHZW_material2" ><a class="material" >' +
                                        SHZW_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        SHZW_Data2[i].proof +
                                        '</span></a></td> </tr>';
                                }
                                SHZW_total2 += SHZW_Data2[i].score;
                            }
                            if (SHZW_html != '') {
                                var SHZW_more_num = SHZW_more_num1 > SHZW_more_num2 ?
                                    SHZW_more_num1 : SHZW_more_num2;
                                $('#SHZW').attr('rowspan', 4 + SHZW_more_num);
                                $(".SHZW_tr").eq(-1).after(SHZW_html);
                            }
                            $('#SHZW_total1').html(SHZW_total1);
                            $('#SHZW_total2').html(SHZW_total2);
                            //加载德育活动
                            DY_html = '';
                            for (var i = 0; i < DY_num1; i++) {
                                if (i < 3) {
                                    $('.DY_name1').eq(i).html(
                                        DY_Data1[i].item_name);
                                    $('.DY_score1').eq(i).html(
                                        DY_Data1[i].score);
                                    $('.DY_material1').eq(i).html(
                                        '<a class="material" >' +
                                        DY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        DY_Data1[i].proof +
                                        '</span></a> ');
                                } else {
                                    DY_more_num1++;
                                    DY_html += '<tr><td class = "DY_name1" >' +
                                        DY_Data1[
                                            i]
                                        .item_name +
                                        ' </td> <td class = "DY_score1" > ' +
                                        DY_Data1[
                                            i].score +
                                        '</td> <td class = "DY_material1" ><a class="material" >' +
                                        DY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        DY_Data1[i].proof +
                                        '</span></a> </td><td class = "DY_name2" > </td> <td class = "DY_score2" > </td> <td class = "DY_material2" > </td> </tr>';
                                }
                                DY_total1 += DY_Data1[i].score;
                            }
                            for (var i = 0; i < DY_num2; i++) {
                                if (i < 3) {
                                    $('.DY_name2').eq(i).html(
                                        DY_Data2[i].item_name);
                                    $('.DY_score2').eq(i).html(
                                        DY_Data2[i].score);
                                    $('.DY_material2').eq(i).html(
                                        '<a class="material" >' +
                                        DY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        DY_Data2[i].proof +
                                        '</span></a> ');
                                } else {
                                    DY_more_num2++;
                                    DY_html +=
                                        '<tr><td class = "DY_name1" ></td> <td class = "DY_score1" ></td> <td class = "DY_material1" > </td><td class = "DY_name2" > ' +
                                        DY_Data2[i]
                                        .item_name +
                                        '</td> <td class = "DY_score2" > ' +
                                        DY_Data2[i].score +
                                        '</td> <td class = "DY_material2" ><a class="material" >' +
                                        DY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        DY_Data2[i].proof +
                                        '</span></a></td> </tr>';
                                }
                                DY_total2 += DY_Data2[i].score;
                            }
                            if (DY_html != '') {
                                var DY_more_num = DY_more_num1 > DY_more_num2 ?
                                    DY_more_num1 : DY_more_num2;
                                $('#DY').attr('rowspan', 4 + DY_more_num);
                                $(".DY_tr").eq(-1).after(DY_html);
                            }
                            $('#DY_total1').html(DY_total1);
                            $('#DY_total2').html(DY_total2);

                            //加载智育活动
                            ZY_html = '';
                            for (var i = 0; i < ZY_num1; i++) {
                                if (i < 3) {
                                    $('.ZY_name1').eq(i).text(
                                        ZY_Data1[i].item_name);
                                    $('.ZY_score1').eq(i).text(
                                        ZY_Data1[i].score);
                                    $('.ZY_material1').eq(i).html(
                                        '<a class="material" >' +
                                        ZY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        ZY_Data1[i].proof +
                                        '</span></a> ');
                                } else {
                                    ZY_more_num1++;
                                    ZY_html += '<tr><td class = "ZY_name1" >' +
                                        ZY_Data1[
                                            i]
                                        .item_name +
                                        ' </td> <td class = "ZY_score1" > ' +
                                        ZY_Data1[
                                            i].score +
                                        '</td> <td class = "ZY_material1" > <a class="material" >' +
                                        ZY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        ZY_Data1[i].proof +
                                        '</span></a> </td><td class = "ZY_name2" > </td> <td class = "ZY_score2" > </td> <td class = "ZY_material2" > </td> </tr>';
                                }
                                ZY_total1 += ZY_Data1[i].score;
                            }
                            for (var i = 0; i < ZY_num2; i++) {
                                if (i < 3) {
                                    $('.ZY_name2').eq(i).text(
                                        ZY_Data2[i].item_name);
                                    $('.ZY_score2').eq(i).text(
                                        ZY_Data2[i].score);
                                    $('.ZY_material2').eq(i).html(
                                        '<a class="material" >' +
                                        ZY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        ZY_Data2[i].proof +
                                        '</span></a> ');
                                } else {
                                    ZY_more_num2++;
                                    ZY_html +=
                                        '<tr><td class = "ZY_name1" >< /td> <td class = "ZY_score1" ></td> <td class = "ZY_material1" > </td><td class = "ZY_name2" > ' +
                                        ZY_Data2[i]
                                        .item_name +
                                        '</td> <td class = "ZY_score2" > ' +
                                        ZY_Data2[i].score +
                                        '</td> <td class = "ZY_material2" > <a class="material" >' +
                                        ZY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        ZY_Data2[i].proof +
                                        '</span></a></td> </tr>';
                                }
                                ZY_total2 += ZY_Data2[i].score;
                            }
                            if (ZY_html != '') {
                                var ZY_more_num = ZY_more_num1 > ZY_more_num2 ?
                                    ZY_more_num1 : ZY_more_num2;
                                $('#ZY').attr('rowspan', 4 + ZY_more_num);
                                $(".ZY_tr").eq(-1).after(ZY_html);
                            }
                            $('#ZY_total1').html(ZY_total1);
                            $('#ZY_total2').html(ZY_total2);

                            //加载体育活动
                            TY_html = '';
                            for (var i = 0; i < TY_num1; i++) {
                                if (i < 3) {
                                    $('.TY_name1').eq(i).text(
                                        TY_Data1[i].item_name);
                                    $('.TY_score1').eq(i).text(
                                        TY_Data1[i].score);
                                    $('.TY_material1').eq(i).html(
                                        '<a class="material" >' +
                                        TY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        TY_Data1[i].proof +
                                        '</span></a> ');
                                } else {
                                    TY_more_num1++;
                                    TY_html +=
                                        '<tr class="TY_tr"><td class = "TY_name1" >' +
                                        TY_Data1[
                                            i]
                                        .item_name +
                                        '</td> <td class = "TY_score1" > ' +
                                        TY_Data1[
                                            i].score +
                                        '</td> <td class = "TY_material1" > <a class="material" >' +
                                        TY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        TY_Data1[i].proof +
                                        '</span></a></td><td class = "TY_name2" > </td> <td class = "TY_score2" > </td> <td class = "TY_material2" > </td> </tr>';
                                }
                                TY_total1 += TY_Data1[i].score;
                            }
                            for (var i = 0; i < TY_num2; i++) {
                                if (i < 3) {
                                    $('.TY_name2').eq(i).text(
                                        TY_Data2[i].item_name);
                                    $('.TY_score2').eq(i).text(
                                        TY_Data2[i].score);
                                    $('.TY_material2').eq(i).html(
                                        '<a class="material" >' +
                                        TY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        TY_Data2[i].proof +
                                        '</span></a> ');
                                } else {
                                    TY_more_num2++;
                                    TY_html +=
                                        '<tr class="TY_tr"><td class = "TY_name1"></td> <td class = "TY_score1" ></td> <td class = "TY_material1" > </td><td class = "TY_name2" > ' +
                                        TY_Data2[i]
                                        .item_name +
                                        '</td> <td class = "TY_score2" > ' +
                                        TY_Data2[i].score +
                                        '</td> <td class = "TY_material2" ><a class="material" >' +
                                        TY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        TY_Data2[i].proof +
                                        '</span></a></td> </tr>';
                                }
                                TY_total2 += TY_Data2[i].score;
                            }
                            if (TY_html != '') {
                                var TY_more_num = TY_more_num1 > TY_more_num2 ?
                                    TY_more_num1 : TY_more_num2;
                                $('#TY').attr('rowspan', 4 + TY_more_num);
                                $(".TY_tr").eq(-1).after(TY_html);
                            }
                            $('#TY_total1').html(TY_total1);
                            $('#TY_total2').html(TY_total2);

                            //加载美育活动
                            MY_html = '';
                            for (var i = 0; i < MY_num1; i++) {
                                if (i < 3) {
                                    $('.MY_name1').eq(i).text(
                                        MY_Data1[i].item_name);
                                    $('.MY_score1').eq(i).text(
                                        MY_Data1[i].score);
                                    $('.MY_material1').eq(i).html(
                                        '<a class="material" >' +
                                        MY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        MY_Data1[i].proof +
                                        '</span></a> ');
                                } else {
                                    MY_more_num1++;
                                    MY_html +=
                                        '<tr class="MY_tr"><td class = ".MY_name1" >' +
                                        MY_Data1[
                                            i]
                                        .item_name +
                                        ' </td> <td class = ".MY_score1" > ' +
                                        MY_Data1[
                                            i].score +
                                        '</td> <td class = "MY_material1" ><a class="material" >' +
                                        MY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        MY_Data1[i].proof +
                                        '</span></a></td><td class = "MY_name2" ></td> <td class = "MY_score2" > </td> <td class = "MY_material2" > </td> </tr>';
                                }
                                MY_total1 += MY_Data1[i].score;
                            }
                            for (var i = 0; i < MY_num2; i++) {
                                if (i < 3) {
                                    $('.MY_name2').eq(i).text(
                                        MY_Data2[i].item_name);
                                    $('.MY_score2').eq(i).text(
                                        MY_Data2[i].score);
                                    $('.MY_material2').eq(i).html(
                                        '<a class="material" >' +
                                        MY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        MY_Data2[i].proof +
                                        '</span></a> ');
                                } else {
                                    MY_more_num2++;
                                    MY_html +=
                                        '<tr class="MY_tr"><td class = "MY_name1"></td><td class = "MY_score1" ></td> <td class = "MY_material1" ></td><td class = "MY_name2" > ' +
                                        MY_Data2[i]
                                        .item_name +
                                        '</td> <td class = "MY_score2" > ' +
                                        MY_Data2[i].score +
                                        '</td> <td class = "MY_material2" ><a class="material" >' +
                                        MY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        MY_Data2[i].proof +
                                        '</span></a></td> </tr>';
                                }
                                MY_total2 += MY_Data2[i].score;
                            }
                            if (MY_html != '') {
                                var MY_more_num = MY_more_num1 > MY_more_num2 ?
                                    MY_more_num1 : MY_more_num2;
                                $('#MY').attr('rowspan', 4 + MY_more_num);
                                $(".MY_tr").eq(-1).after(MY_html);
                            }
                            $('#MY_total1').html(MY_total1);
                            $('#MY_total2').html(MY_total2);

                            //加载劳育活动
                            LY_html = '';
                            for (var i = 0; i < LY_num1; i++) {
                                if (i < 3) {
                                    $('.LY_name1').eq(i).text(
                                        LY_Data1[i].item_name);
                                    $('.LY_score1').eq(i).text(
                                        LY_Data1[i].score);
                                    $('.LY_material1').eq(i).html(
                                        '<a class="material" >' +
                                        LY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        LY_Data1[i].proof +
                                        '</span></a> ');
                                } else {
                                    LY_more_num1++;
                                    LY_html +=
                                        '<tr class="LY_tr"><td class = ".LY_name1" >' +
                                        LY_Data1[
                                            i]
                                        .item_name +
                                        ' </td> <td class = ".LY_score1" > ' +
                                        LY_Data1[
                                            i].score +
                                        '</td> <td class = "LY_material1" ><a class="material" >' +
                                        LY_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        LY_Data1[i].proof +
                                        '</span></a></td><td class = "LY_name2" ></td> <td class = "LY_score2" > </td> <td class = "LY_material2" > </td> </tr>';
                                }
                                KY_total1 += LY_Data1[i].score;
                            }
                            for (var i = 0; i < LY_num2; i++) {
                                if (i < 3) {
                                    $('.LY_name2').eq(i).text(
                                        LY_Data2[i].item_name);
                                    $('.LY_score2').eq(i).text(
                                        LY_Data2[i].score);
                                    $('.LY_material2').eq(i).html(
                                        '<a class="material" >' +
                                        LY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        LY_Data2[i].proof +
                                        '</span></a> ');
                                } else {
                                    LY_more_num2++;
                                    LY_html +=
                                        '<tr class="LY_tr"><td class = "LY_name1"></td><td class = "LY_score1" ></td> <td class = "LY_material1" ></td><td class = "LY_name2" > ' +
                                        LY_Data2[i]
                                        .item_name +
                                        '</td> <td class = "LY_score2" > ' +
                                        LY_Data2[i].score +
                                        '</td> <td class = "LY_material2" ><a class="material" >' +
                                        LY_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        LY_Data2[i].proof +
                                        '</span></a></td> </tr>';
                                }
                                LY_total2 += LY_Data2[i].score;
                            }
                            if (LY_html != '') {
                                var LY_more_num = LY_more_num1 > LY_more_num2 ?
                                    LY_more_num1 : LY_more_num2;
                                $('#LY').attr('rowspan', 4 + LY_more_num);
                                $(".LY_tr").eq(-1).after(LY_html);
                            }
                            $('#LY_total1').html(LY_total1);
                            $('#LY_total2').html(LY_total2);

                            //加载扣分项目
                            KF_html = '';
                            for (var i = 0; i < KF_num1; i++) {
                                if (i < 3) {
                                    $('.KF_name1').eq(i).text(
                                        KF_Data1[i].item_name);
                                    $('.KF_score1').eq(i).text(
                                        KF_Data1[i].score);
                                    $('.KF_material1').eq(i).html(
                                        '<a class="material" >' +
                                        KF_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        KF_Data1[i].proof +
                                        '</span></a> ');
                                } else {
                                    KF_more_num1++;
                                    KF_html +=
                                        '<tr class="KF_tr"><td class = ".KF_name1" >' +
                                        KF_Data1[
                                            i]
                                        .item_name +
                                        ' </td> <td class = ".KF_score1" > ' +
                                        KF_Data1[
                                            i].score +
                                        '</td> <td class = "KF_material1" ><a class="material" >' +
                                        KF_Data1[i].key +
                                        ' <span class="link" style="display:none">' +
                                        KF_Data1[i].proof +
                                        '</span></a></td><td class = "KF_name2" ></td> <td class = "KF_score2" > </td> <td class = "KF_material2" > </td> </tr>';
                                }
                                KF_total1 += KF_Data1[i].score;
                            }
                            for (var i = 0; i < KF_num2; i++) {
                                if (i < 3) {
                                    $('.KF_name2').eq(i).text(
                                        KF_Data2[i].item_name);
                                    $('.KF_score2').eq(i).text(
                                        KF_Data2[i].score);
                                    $('.KF_material2').eq(i).html(
                                        '<a class="material" >' +
                                        KF_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        KF_Data2[i].proof +
                                        '</span></a> ');
                                } else {
                                    KF_more_num2++;
                                    KF_html +=
                                        '<tr class="KF_tr"><td class = "KF_name1"></td><td class = "KF_score1" ></td> <td class = "MY_material1" ></td><td class = "MY_name2" > ' +
                                        KF_Data2[i]
                                        .item_name +
                                        '</td> <td class = "KF_score2" > ' +
                                        KF_Data2[i].score +
                                        '</td> <td class = "KF_material2" ><a class="material" >' +
                                        KF_Data2[i].key +
                                        ' <span class="link" style="display:none">' +
                                        KF_Data2[i].proof +
                                        '</span></a> </td> </tr>';
                                }
                                KF_total2 += KF_Data2[i].score;
                            }
                            if (KF_html != '') {
                                var KF_more_num = KF_more_num1 > KF_more_num2 ?
                                    KF_more_num1 : KF_more_num2;
                                $('#KF').attr('rowspan', 4 + KF_more_num);
                                $(".KF_tr").eq(-1).after(KF_html);
                            }
                            $('#KF_total1').html(KF_total1);
                            $('#KF_total2').html(KF_total2);

                            localStorage.setItem("SHZW_Data1", JSON.stringify(
                                SHZW_Data1));
                            localStorage.setItem("SHZW_Data2", JSON.stringify(
                                SHZW_Data2));
                            localStorage.setItem("DY_Data1", JSON.stringify(
                                DY_Data1));
                            localStorage.setItem("DY_Data2", JSON.stringify(
                                DY_Data2));
                            localStorage.setItem("ZY_Data1", JSON.stringify(
                                ZY_Data1));
                            localStorage.setItem("ZY_Data2", JSON.stringify(
                                ZY_Data2));
                            localStorage.setItem("TY_Data1", JSON.stringify(
                                TY_Data1));
                            localStorage.setItem("TY_Data2", JSON.stringify(
                                TY_Data2));
                            localStorage.setItem("MY_Data1", JSON.stringify(
                                MY_Data1));
                            localStorage.setItem("MY_Data2", JSON.stringify(
                                MY_Data2));
                            localStorage.setItem("LY_Data1", JSON.stringify(
                                LY_Data1));
                            localStorage.setItem("LY_Data2", JSON.stringify(
                                LY_Data2));
                            localStorage.setItem("KF_Data1", JSON.stringify(
                                KF_Data1));
                            localStorage.setItem("KF_Data2", JSON.stringify(
                                KF_Data2));
                            var T1 = SHZW_total1 +
                                SHZW_total2; //T1为社会职务加分，上限为25分
                            if (T1 >= 25)
                                T1 = 25;
                            var T2 = DY_total1 + DY_total2; //T2为德育加分，上限为30分
                            if (T2 >= 30)
                                T2 = 30;
                            var T3 = ZY_total1 + ZY_total2; //T3为智育(创新)加分，无上限
                            var T4_T5 = TY_total1 + TY_total2 + MY_total1 +
                                MY_total2; //T4为体育加分，T5为美育加分，T4 与T5总和的上限为50分
                            if (T4_T5 >= 50)
                                T4_T5 = 50;
                            var T6 = LY_total1 +
                                LY_total2; //T6为劳育加分，该项为附加分，上限为5分
                            if (T6 >= 5)
                                T6 = 5;
                            var T7 = Math.abs(KF_total1) + Math.abs(
                                KF_total2); //T7为扣分内容
                            var total = T1 + T2 + T3 + T4_T5 + T6 - T7;
                            if (total >= 100)
                                total = 100; //量化上限100
                            $('#total').html(total);
                            var name = localStorage.getItem(
                                "name");
                            $('#self_writing').html(name);
                            if (status == 3) {
                                var teacher = localStorage.getItem("teacher");
                                $('#teacher_writing').html(teacher)
                            }
                        })
                    }
                })
            });

        });
    </script>
</body>